package com.baichen.ai.tools;

import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import dev.langchain4j.agent.tool.ToolMemoryId;
import org.springframework.stereotype.Component;

@Component
public class CalculatorTools {

    @Tool(name = "sum", value = "Calculate the sum of two numbers")
    double sum(
            @ToolMemoryId int memoryId,
            @P(value = "加数1", required = true) double a,
            @P(value = "加数2", required = true) double b) {
        System.out.println("CalculatorTools.sum called with memoryId: " + memoryId);
        return a + b;
    }

    @Tool
    double squareRoot(
            @ToolMemoryId int memoryId,
            @P(value = "加数1", required = true) double a
    ) {
        System.out.println("CalculatorTools.squareRoot called with memoryId: " + memoryId);
        return Math.sqrt(a);
    }
}
